#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef struct teacher{
    int id;
    char name[10];
    char job_title[10];
    char academy[10];
    struct teacher *next;
}*st;
st newNode(){
    st node=(st)malloc(sizeof(struct teacher));
    scanf("%d",&node->id);
    scanf("%s",&node->name);
    scanf("%s",&node->job_title);
    scanf("%s",&node->academy);
    node->next=NULL;
    return node;
}
st create_st(st head){
    if(head==NULL){
        head=newNode();
        // printf("%d",head->id);
        return head;
    }
    st p=head,pre;
    st node=newNode();
    if(node->id<=p->id){//如果新插入节点的id不大于头节点id
        node->next=head;
        head=node;
    }else{//新插入节点id大于p节点
        while(p->next!=NULL){
            if(node->id<p->next->id) break;
            p=p->next;//后移
        }//已经找到待插入位置或者已经到达最后一个节点
        node->next=p->next;
        p->next=node;
    }
    return head;
}
void print_st(st head){
    st p=head;
    while(p){
        printf("%d\t%s\t%s\t%s\n",p->id,p->name,p->job_title,p->academy);
        p=p->next;
    }
}
int main(){
    st head=NULL;
    for(int i=0;i<4;i++)
        head=create_st(head);
    print_st(head);
    return 0;
}